<?php

/***********************************************/
/*CONTENIDO*/
/***********************************************/
echo" <div class=\"pag_content\">
 	<div class=\"pag_content_title\">
		<div class=\"pag_title_cap\">Cap&iacute;tulo 11: </div>
		<div class=\"pag_title_cont\">Gesti&oacute;n de recursos</div>
    </div>
    <div class=\"pag_content_body\">         
	<div class=\"contenido_principal\">	
		<br />";
		
/***********************************************/
/*TITULO PARTE*/
/***********************************************/

echo"	<div class=\"parrafo_titulo\">
	Ejemplo Pr&aacute;ctico
	</div>";		

	
/***********************************************/
/*CONTENIDO*/
/***********************************************/

echo"
<div class=\"parrafo\" align=\"justify\">
Vamos a utilizar todos los puntos anteriores en un ejemplo practico. Vamos a pensar en una empresa en la que su horario de alta disponibilidad es durante el dia (entorno OLTP). Mientras que durante la noche se vuelcan todos los datos para ser analizados (etorno OLAP).
</div>
<div class=\"parrafo\" align=\"justify\">
Vamos a considerar dos tipos de planes, uno para el dia DAY_PLAN y otro para la noche OFF_HOURS_PLAN.
</div>
<div class=\"parrafo\" align=\"justify\">
1. Creamos pending area.
</div>
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>SQL&GT; exec DBMS_RESOURCE_MANAGER.create_pending_area();

</p></pre></blockquote>
<div class=\"parrafo\" align=\"justify\">
2. Creamos los grupos de usuarios.
</div>
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>SQL&GT; exec DBMS_RESOURCE_MANAGER.create_consumer_group(
	CONSUMER_GROUP 	=> 'OLTP_GROUP',
	COMMENT	=> 'Incoming orders');

SQL&GT; exec DBMS_RESOURCE_MANAGER.create_consumer_group(
	CONSUMER_GROUP 	=> 'DAY_REPORTS_GROUP',
	COMMENT	=> 'Reportes diarios');

SQL&GT; exec DBMS_RESOURCE_MANAGER.create_consumer_group(
	CONSUMER_GROUP 	=> 'NIGHTLY_PROCESSING_GROUP',
	COMMENT	=> 'BULK LOADS');

SQL&GT; exec DBMS_RESOURCE_MANAGER.create_consumer_group(
	CONSUMER_GROUP 	=> 'OLAP_REPORTS_GROUP',
	COMMENT	=> 'Reportes nocturnos');

</p></pre></blockquote>
<div class=\"parrafo\" align=\"justify\">
3. Creamos los planes de recursos
</div>
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan(
	PLAN	=> 'DAY_PLAN',
	COMMENT	=> 'Plan para horas de curro');

SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan(
	PLAN	=> 'OLTP_PLAN',
	COMMENT	=> 'Sub-plan');

SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan(
	PLAN	=> 'OFF_HOURS_PLAN',
	COMMENT	=> 'Plan Nocturno',
	CPU_MTH	=> 'Ratio');

</p></pre></blockquote>
<div class=\"parrafo\" align=\"justify\">
4. Creamos las directivas
</div>
<div class=\"parrafo\" align=\"justify\">
4.1 Para el plan OFF_HOURS
</div>
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan_directive(
	PLAN		=> 'OFF_HOURS_PLAN',
	GROUP_OR_SUBPLAN	=> 'SYS_GROUP',
	COMMENT	=> 'CPU asignado para SYS_GROUP',
	CPU_P1	=>10);

SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan_directive(
	PLAN		=> 'OFF_HOURS_PLAN',
	GROUP_OR_SUBPLAN	=> 'NIGHTLY_PROCESSING_GROUP',
	COMMENT	=> 'CPU asignado para trabajos nocturnos',
	CPU_P1	=>5);

SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan_directive(
	PLAN		=> 'OFF_HOURS_PLAN',
	GROUP_OR_SUBPLAN	=> 'OLAP_REPORTS_GROUP',
	COMMENT	=> 'Reportes nocturnos',
	CPU_P1	=>2);

SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan_directive(
	PLAN		=> 'OFF_HOURS_PLAN',
	GROUP_OR_SUBPLAN	=> 'OTHER_GROUPS',
	COMMENT	=> 'Otros grupos',
	CPU_P1	=>1);

</p></pre></blockquote>
<div class=\"parrafo\" align=\"justify\">
4.2 Para OLTP_PLAN
</div>
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>	SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan_directive(
	PLAN		=> 'OLTP_PLAN',
	GROUP_OR_SUBPLAN	=> 'OLTP_GROUP',
	COMMENT	=> 'OLTP Users',
	CPU_P1	=>90);
	
	SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan_directive(
	PLAN		=> 'OLTP_PLAN',
	GROUP_OR_SUBPLAN	=> 'DAY_REPORTS_GROUP',
	COMMENT	=> 'Reportes diarios',
	CPU_P1	=>10);

	SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan_directive(
	PLAN		=> 'OLTP_PLAN',
	GROUP_OR_SUBPLAN	=> 'OTHER_GROUPS',
	COMMENT	=> 'Resto de grupos',
	CPU_P2	=>100);
	
</p></pre></blockquote>
<div class=\"parrafo\" align=\"justify\">
4.3 Para DAY_PLAN
</div>
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan_directive(
	PLAN		=> 'DAY_PLAN',
	GROUP_OR_SUBPLAN	=> 'SYS_GROUP',
	COMMENT	=> 'CPU para SYS_GROUP',
	CPU_P1	=>100);

SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan_directive(
	PLAN		=> 'DAY_PLAN',
	GROUP_OR_SUBPLAN	=> 'OLTP_PLAN',
	COMMENT	=> 'CPU para OLTP_PLAN sub-plan',
	CPU_P2	=>100);

SQL&GT; exec DBMS_RESOURCE_MANAGER.create_plan_directive(
	PLAN		=> 'DAY_PLAN',
	GROUP_OR_SUBPLAN	=> 'OTHER_GROUPS',
	COMMENT	=> 'CPU para OLTP_PLAN sub-plan',
	CPU_P3	=>100);

</p></pre></blockquote>
<div class=\"parrafo\" align=\"justify\">
5. Validamos la pending area
</div>
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>	SQL&GT; exec dbms_resource_manager.validate_pending_area;

</p></pre></blockquote>
<div class=\"parrafo\" align=\"justify\">
6. Activamos cambios
</div>
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>SQL&GT; exec dbms_resource_manager.validate_pending_area;
</p></pre></blockquote>

";
	
echo"
	</div> 		 
    </div>
    <div class=\"pag_content_footer\">
    </div>
    <div class=\"pag_content_nav\">		
		<div class=\"pag_contenido_left\">
			<a class=\"cap_next\" href=\"ocp_main.php?cap=11&part=4\">	&lt; Anterior </a>
		 </div>
		<div class=\"pag_contenido_right\" align=\"right\">	
			<a  class=\"cap_next\" href=\"ocp_main.php?cap=11&part=6\">	Siguiente &gt;</a>
		 </div>
	</div>      
</div>
";


?>